package org.htmlparser.parserapplications;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.HashSet;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import org.htmlparser.NodeFilter;
import org.htmlparser.Parser;
import org.htmlparser.PrototypicalNodeFactory;
import org.htmlparser.lexer.Lexer;
import org.htmlparser.lexer.Page;
import org.htmlparser.tags.BaseHrefTag;
import org.htmlparser.tags.FrameTag;
import org.htmlparser.tags.ImageTag;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.util.ParserException;

public class SiteCapturer
{
  static Class class$org$htmlparser$tags$MetaTag;
  protected final int TRANSFER_SIZE = 4096;
  protected boolean mCaptureResources;
  protected HashSet mCopied;
  protected NodeFilter mFilter;
  protected HashSet mFinished;
  protected ArrayList mImages;
  protected ArrayList mPages;
  protected Parser mParser;
  protected String mSource = null;
  protected String mTarget = null;

  public SiteCapturer()
  {
    this.mPages = new ArrayList();
    this.mFinished = new HashSet();
    this.mImages = new ArrayList();
    this.mCopied = new HashSet();
    this.mParser = new Parser();
    PrototypicalNodeFactory localPrototypicalNodeFactory = new PrototypicalNodeFactory();
    localPrototypicalNodeFactory.registerTag(new LocalLinkTag(this));
    localPrototypicalNodeFactory.registerTag(new LocalFrameTag(this));
    localPrototypicalNodeFactory.registerTag(new LocalBaseHrefTag(this));
    localPrototypicalNodeFactory.registerTag(new LocalImageTag(this));
    this.mParser.setNodeFactory(localPrototypicalNodeFactory);
    this.mCaptureResources = true;
    this.mFilter = null;
  }

  static Class class$(String paramString)
  {
    Class localClass;
    try
    {
      localClass = Class.forName(paramString);
      return localClass;
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      throw new NoClassDefFoundError().initCause(localClassNotFoundException);
    }
  }

  public static void main(String[] paramArrayOfString)
    throws MalformedURLException, IOException
  {
    SiteCapturer localSiteCapturer = new SiteCapturer();
    if (paramArrayOfString.length <= 0)
    {
      String str = (String)JOptionPane.showInputDialog(null, "Enter the URL to capture:", "Web Site", -1, null, null, "http://htmlparser.sourceforge.net/wiki");
      if (str != null)
      {
        localSiteCapturer.setSource(str);
        if (1 < paramArrayOfString.length)
          break label286;
        URL localURL = new URL(localSiteCapturer.getSource());
        File localFile = new File(new File(new File("." + File.separator), localURL.getHost() + File.separator).getCanonicalPath());
        JFileChooser localJFileChooser = new JFileChooser(localFile);
        localJFileChooser.setDialogType(1);
        localJFileChooser.setFileSelectionMode(1);
        localJFileChooser.setSelectedFile(localFile);
        localJFileChooser.setMultiSelectionEnabled(false);
        localJFileChooser.setDialogTitle("Target Directory");
        if (localJFileChooser.showSaveDialog(null) != 0)
          break label279;
        localSiteCapturer.setTarget(localJFileChooser.getSelectedFile().getAbsolutePath());
        if (2 < paramArrayOfString.length)
          break label303;
        Object[] arrayOfObject = new Object[2];
        arrayOfObject[0] = Boolean.TRUE;
        arrayOfObject[1] = Boolean.FALSE;
        Boolean localBoolean = (Boolean)JOptionPane.showInputDialog(null, "Should resources be captured:", "Capture Resources", -1, null, arrayOfObject, Boolean.TRUE);
        if (localBoolean == null)
          break label296;
        localSiteCapturer.setCaptureResources(localBoolean.booleanValue());
      }
    }
    while (true)
    {
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                localSiteCapturer.capture();
                System.exit(0);
                return;
                System.exit(1);
              }
              localSiteCapturer.setSource(paramArrayOfString[0]);
            }
            label279: System.exit(1);
          }
          label286: localSiteCapturer.setTarget(paramArrayOfString[1]);
        }
        label296: System.exit(1);
      }
      label303: localSiteCapturer.setCaptureResources(Boolean.valueOf(paramArrayOfString[2]).booleanValue());
    }
  }

  public void capture()
  {
    this.mPages.clear();
    this.mPages.add(getSource());
    if (this.mPages.size() != 0)
      try
      {
        do
          process(getFilter());
        while (this.mImages.size() == 0);
        label127: copy();
      }
      catch (ParserException localParserException)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              Throwable localThrowable1 = localParserException.getThrowable();
              if (localThrowable1 == null)
                break label127;
              Throwable localThrowable2 = localThrowable1.getCause();
              if (!(localThrowable2 instanceof FileNotFoundException))
                break;
              System.err.println("broken link " + ((FileNotFoundException)localThrowable2).getMessage() + " ignored");
            }
            localParserException.printStackTrace();
          }
          localParserException.printStackTrace();
        }
      }
  }

  // ERROR //
  protected void copy()
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 57	org/htmlparser/parserapplications/SiteCapturer:mImages	Ljava/util/ArrayList;
    //   4: iconst_0
    //   5: invokevirtual 289	java/util/ArrayList:remove	(I)Ljava/lang/Object;
    //   8: checkcast 122	java/lang/String
    //   11: astore_1
    //   12: aload_0
    //   13: getfield 59	org/htmlparser/parserapplications/SiteCapturer:mCopied	Ljava/util/HashSet;
    //   16: aload_1
    //   17: invokevirtual 290	java/util/HashSet:add	(Ljava/lang/Object;)Z
    //   20: pop
    //   21: aload_0
    //   22: invokevirtual 293	org/htmlparser/parserapplications/SiteCapturer:getCaptureResources	()Z
    //   25: ifeq +181 -> 206
    //   28: aload_0
    //   29: aload_0
    //   30: aload_1
    //   31: ldc_w 295
    //   34: invokevirtual 299	org/htmlparser/parserapplications/SiteCapturer:makeLocalLink	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   37: invokevirtual 303	org/htmlparser/parserapplications/SiteCapturer:decode	(Ljava/lang/String;)Ljava/lang/String;
    //   40: astore_3
    //   41: new 136	java/io/File
    //   44: dup
    //   45: aload_0
    //   46: invokevirtual 306	org/htmlparser/parserapplications/SiteCapturer:getTarget	()Ljava/lang/String;
    //   49: aload_3
    //   50: invokespecial 309	java/io/File:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   53: astore 4
    //   55: getstatic 312	java/lang/System:out	Ljava/io/PrintStream;
    //   58: new 138	java/lang/StringBuffer
    //   61: dup
    //   62: invokespecial 139	java/lang/StringBuffer:<init>	()V
    //   65: ldc_w 314
    //   68: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   71: aload_1
    //   72: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   75: ldc_w 316
    //   78: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   81: aload 4
    //   83: invokevirtual 196	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   86: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   89: invokevirtual 151	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   92: invokevirtual 282	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   95: aload 4
    //   97: invokevirtual 319	java/io/File:getParentFile	()Ljava/io/File;
    //   100: astore 5
    //   102: aload 5
    //   104: invokevirtual 322	java/io/File:exists	()Z
    //   107: ifne +9 -> 116
    //   110: aload 5
    //   112: invokevirtual 325	java/io/File:mkdirs	()Z
    //   115: pop
    //   116: new 128	java/net/URL
    //   119: dup
    //   120: aload_1
    //   121: invokespecial 134	java/net/URL:<init>	(Ljava/lang/String;)V
    //   124: astore 6
    //   126: sipush 4096
    //   129: newarray byte
    //   131: astore 9
    //   133: aload 6
    //   135: invokevirtual 329	java/net/URL:openStream	()Ljava/io/InputStream;
    //   138: astore 11
    //   140: new 331	java/io/FileOutputStream
    //   143: dup
    //   144: aload 4
    //   146: invokespecial 332	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   149: astore 12
    //   151: aload 11
    //   153: aload 9
    //   155: iconst_0
    //   156: aload 9
    //   158: arraylength
    //   159: invokevirtual 338	java/io/InputStream:read	([BII)I
    //   162: istore 16
    //   164: bipush 255
    //   166: iload 16
    //   168: if_icmpeq +39 -> 207
    //   171: aload 12
    //   173: aload 9
    //   175: iconst_0
    //   176: iload 16
    //   178: invokevirtual 342	java/io/FileOutputStream:write	([BII)V
    //   181: goto -30 -> 151
    //   184: astore 13
    //   186: aload 12
    //   188: invokevirtual 345	java/io/FileOutputStream:close	()V
    //   191: aload 13
    //   193: athrow
    //   194: astore 15
    //   196: aload 15
    //   198: invokevirtual 346	java/io/FileNotFoundException:printStackTrace	()V
    //   201: aload 11
    //   203: invokevirtual 347	java/io/InputStream:close	()V
    //   206: return
    //   207: aload 12
    //   209: invokevirtual 345	java/io/FileOutputStream:close	()V
    //   212: aload 11
    //   214: invokevirtual 347	java/io/InputStream:close	()V
    //   217: goto -11 -> 206
    //   220: astore 10
    //   222: getstatic 270	java/lang/System:err	Ljava/io/PrintStream;
    //   225: new 138	java/lang/StringBuffer
    //   228: dup
    //   229: invokespecial 139	java/lang/StringBuffer:<init>	()V
    //   232: ldc_w 272
    //   235: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   238: aload 10
    //   240: invokevirtual 275	java/io/FileNotFoundException:getMessage	()Ljava/lang/String;
    //   243: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   246: ldc_w 277
    //   249: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   252: invokevirtual 151	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   255: invokevirtual 282	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   258: goto -52 -> 206
    //   261: astore 8
    //   263: aload 8
    //   265: invokevirtual 348	MalformedURLException:printStackTrace	()V
    //   268: goto -62 -> 206
    //   271: astore 14
    //   273: aload 11
    //   275: invokevirtual 347	java/io/InputStream:close	()V
    //   278: aload 14
    //   280: athrow
    //   281: astore 7
    //   283: aload 7
    //   285: invokevirtual 349	IOException:printStackTrace	()V
    //   288: goto -82 -> 206
    //
    // Exception table:
    //   from	to	target	type
    //   151	181	184	finally
    //   140	151	194	java/io/FileNotFoundException
    //   186	194	194	java/io/FileNotFoundException
    //   207	212	194	java/io/FileNotFoundException
    //   133	140	220	java/io/FileNotFoundException
    //   201	206	220	java/io/FileNotFoundException
    //   212	217	220	java/io/FileNotFoundException
    //   273	281	220	java/io/FileNotFoundException
    //   116	133	261	MalformedURLException
    //   133	140	261	MalformedURLException
    //   201	206	261	MalformedURLException
    //   212	217	261	MalformedURLException
    //   222	258	261	MalformedURLException
    //   273	281	261	MalformedURLException
    //   140	151	271	finally
    //   186	194	271	finally
    //   196	201	271	finally
    //   207	212	271	finally
    //   116	133	281	IOException
    //   133	140	281	IOException
    //   201	206	281	IOException
    //   212	217	281	IOException
    //   222	258	281	IOException
    //   273	281	281	IOException
  }

  protected String decode(String paramString)
  {
    int l;
    int i1;
    StringBuffer localStringBuffer = new StringBuffer(paramString.length());
    int i = paramString.length();
    int j = 0;
    int k = paramString.indexOf(37, j);
    if (-1 != k)
    {
      localStringBuffer.append(paramString.substring(j, k));
      if (k + 2 < i)
      {
        l = k + 1;
        i1 = k + 3;
      }
    }
    try
    {
      localStringBuffer.append((char)Integer.parseInt(paramString.substring(l, i1), 16));
      j = k + 3;
    }
    catch (NumberFormatException localNumberFormatException)
    {
      while (true)
      {
        while (true)
        {
          localStringBuffer.append('%');
          j = k + 1;
        }
        localStringBuffer.append('%');
        j = k + 1;
      }
      localStringBuffer.append(paramString.substring(j));
      return localStringBuffer.toString();
    }
  }

  public boolean getCaptureResources()
  {
    return this.mCaptureResources;
  }

  public NodeFilter getFilter()
  {
    return this.mFilter;
  }

  public String getSource()
  {
    return this.mSource;
  }

  public String getTarget()
  {
    return this.mTarget;
  }

  protected boolean isHtml(String paramString)
    throws ParserException
  {
    String str;
    int i;
    try
    {
      str = new URL(paramString).openConnection().getContentType();
      if (str == null)
      {
        i = 0;
      }
      else
      {
        boolean bool = str.startsWith("text/html");
        i = bool;
      }
    }
    catch (Exception localException)
    {
      throw new ParserException("URL " + paramString + " has a problem", localException);
    }
    return i;
  }

  protected boolean isToBeCaptured(String paramString)
  {
    int i;
    if ((paramString.toLowerCase().startsWith(getSource().toLowerCase())) && (-1 == paramString.indexOf("?")) && (-1 == paramString.indexOf("#")))
      i = 1;
    while (true)
    {
      return i;
      i = 0;
    }
  }

  protected String makeLocalLink(String paramString1, String paramString2)
  {
    String str1;
    if ((paramString1.equals(getSource())) || ((!(getSource().endsWith("/"))) && (paramString1.equals(getSource() + "/"))))
      str1 = "index.html";
    while (true)
    {
      while (true)
      {
        if ((paramString2 == null) || (!(paramString1.startsWith(getSource()))) || (paramString2.length() <= getSource().length()))
          break label200;
        String str2 = paramString2.substring(1 + getSource().length());
        int i = 0;
        while (true)
        {
          int j = str2.indexOf(47, i);
          if (-1 == j)
            break label200;
          str1 = "../" + str1;
          i = j + 1;
        }
        if ((!(paramString1.startsWith(getSource()))) || (paramString1.length() <= getSource().length()))
          break;
        str1 = paramString1.substring(1 + getSource().length());
      }
      str1 = paramString1;
    }
    label200: return str1;
  }

  // ERROR //
  protected void process(NodeFilter paramNodeFilter)
    throws ParserException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 50	org/htmlparser/parserapplications/SiteCapturer:mPages	Ljava/util/ArrayList;
    //   4: iconst_0
    //   5: invokevirtual 289	java/util/ArrayList:remove	(I)Ljava/lang/Object;
    //   8: checkcast 122	java/lang/String
    //   11: astore_2
    //   12: getstatic 312	java/lang/System:out	Ljava/io/PrintStream;
    //   15: new 138	java/lang/StringBuffer
    //   18: dup
    //   19: invokespecial 139	java/lang/StringBuffer:<init>	()V
    //   22: ldc_w 428
    //   25: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   28: aload_2
    //   29: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   32: invokevirtual 151	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   35: invokevirtual 282	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   38: aload_0
    //   39: getfield 55	org/htmlparser/parserapplications/SiteCapturer:mFinished	Ljava/util/HashSet;
    //   42: aload_2
    //   43: invokevirtual 290	java/util/HashSet:add	(Ljava/lang/Object;)Z
    //   46: pop
    //   47: aload_0
    //   48: getfield 50	org/htmlparser/parserapplications/SiteCapturer:mPages	Ljava/util/ArrayList;
    //   51: invokevirtual 244	java/util/ArrayList:size	()I
    //   54: istore 8
    //   56: aload_0
    //   57: getfield 64	org/htmlparser/parserapplications/SiteCapturer:mParser	Lorg/htmlparser/Parser;
    //   60: aload_2
    //   61: invokevirtual 431	org/htmlparser/Parser:setURL	(Ljava/lang/String;)V
    //   64: new 433	org/htmlparser/util/NodeList
    //   67: dup
    //   68: invokespecial 434	org/htmlparser/util/NodeList:<init>	()V
    //   71: astore 9
    //   73: aload_0
    //   74: getfield 64	org/htmlparser/parserapplications/SiteCapturer:mParser	Lorg/htmlparser/Parser;
    //   77: invokevirtual 438	org/htmlparser/Parser:elements	()Lorg/htmlparser/util/NodeIterator;
    //   80: astore 33
    //   82: aload 33
    //   84: invokeinterface 443 1 0
    //   89: ifeq +144 -> 233
    //   92: aload 33
    //   94: invokeinterface 447 1 0
    //   99: astore 34
    //   101: aload 9
    //   103: aload 34
    //   105: invokevirtual 450	org/htmlparser/util/NodeList:add	(Lorg/htmlparser/Node;)V
    //   108: goto -26 -> 82
    //   111: astore 10
    //   113: aload_0
    //   114: getfield 64	org/htmlparser/parserapplications/SiteCapturer:mParser	Lorg/htmlparser/Parser;
    //   117: invokevirtual 453	org/htmlparser/Parser:reset	()V
    //   120: new 433	org/htmlparser/util/NodeList
    //   123: dup
    //   124: invokespecial 434	org/htmlparser/util/NodeList:<init>	()V
    //   127: astore 9
    //   129: aload_0
    //   130: getfield 64	org/htmlparser/parserapplications/SiteCapturer:mParser	Lorg/htmlparser/Parser;
    //   133: invokevirtual 438	org/htmlparser/Parser:elements	()Lorg/htmlparser/util/NodeIterator;
    //   136: astore 11
    //   138: aload 11
    //   140: invokeinterface 443 1 0
    //   145: ifeq +88 -> 233
    //   148: aload 11
    //   150: invokeinterface 447 1 0
    //   155: astore 32
    //   157: aload 9
    //   159: aload 32
    //   161: invokevirtual 450	org/htmlparser/util/NodeList:add	(Lorg/htmlparser/Node;)V
    //   164: goto -26 -> 138
    //   167: astore 4
    //   169: aload 4
    //   171: invokevirtual 454	ParserException:getMessage	()Ljava/lang/String;
    //   174: astore 5
    //   176: aload 5
    //   178: ifnull +462 -> 640
    //   181: aload 5
    //   183: ldc_w 456
    //   186: invokevirtual 420	java/lang/String:endsWith	(Ljava/lang/String;)Z
    //   189: ifeq +451 -> 640
    //   192: aload_0
    //   193: getfield 59	org/htmlparser/parserapplications/SiteCapturer:mCopied	Ljava/util/HashSet;
    //   196: aload_2
    //   197: invokevirtual 459	java/util/HashSet:contains	(Ljava/lang/Object;)Z
    //   200: ifne +23 -> 223
    //   203: aload_0
    //   204: getfield 57	org/htmlparser/parserapplications/SiteCapturer:mImages	Ljava/util/ArrayList;
    //   207: aload_2
    //   208: invokevirtual 460	java/util/ArrayList:contains	(Ljava/lang/Object;)Z
    //   211: ifne +12 -> 223
    //   214: aload_0
    //   215: getfield 57	org/htmlparser/parserapplications/SiteCapturer:mImages	Ljava/util/ArrayList;
    //   218: aload_2
    //   219: invokevirtual 240	java/util/ArrayList:add	(Ljava/lang/Object;)Z
    //   222: pop
    //   223: aload_0
    //   224: getfield 55	org/htmlparser/parserapplications/SiteCapturer:mFinished	Ljava/util/HashSet;
    //   227: aload_2
    //   228: invokevirtual 462	java/util/HashSet:remove	(Ljava/lang/Object;)Z
    //   231: pop
    //   232: return
    //   233: getstatic 464	org/htmlparser/parserapplications/SiteCapturer:class$org$htmlparser$tags$MetaTag	Ljava/lang/Class;
    //   236: ifnonnull +146 -> 382
    //   239: ldc_w 466
    //   242: invokestatic 468	org/htmlparser/parserapplications/SiteCapturer:class$	(Ljava/lang/String;)Ljava/lang/Class;
    //   245: astore 12
    //   247: aload 12
    //   249: putstatic 464	org/htmlparser/parserapplications/SiteCapturer:class$org$htmlparser$tags$MetaTag	Ljava/lang/Class;
    //   252: new 470	org/htmlparser/filters/AndFilter
    //   255: dup
    //   256: new 472	org/htmlparser/filters/NodeClassFilter
    //   259: dup
    //   260: aload 12
    //   262: invokespecial 475	org/htmlparser/filters/NodeClassFilter:<init>	(Ljava/lang/Class;)V
    //   265: new 477	org/htmlparser/filters/HasAttributeFilter
    //   268: dup
    //   269: ldc_w 479
    //   272: ldc_w 481
    //   275: invokespecial 482	org/htmlparser/filters/HasAttributeFilter:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   278: invokespecial 485	org/htmlparser/filters/AndFilter:<init>	(Lorg/htmlparser/NodeFilter;Lorg/htmlparser/NodeFilter;)V
    //   281: astore 13
    //   283: aload 9
    //   285: aload 13
    //   287: iconst_1
    //   288: invokevirtual 489	org/htmlparser/util/NodeList:extractAllNodesThatMatch	(Lorg/htmlparser/NodeFilter;Z)Lorg/htmlparser/util/NodeList;
    //   291: astore 14
    //   293: aload 14
    //   295: invokevirtual 490	org/htmlparser/util/NodeList:size	()I
    //   298: ifeq +118 -> 416
    //   301: aload 14
    //   303: iconst_0
    //   304: invokevirtual 494	org/htmlparser/util/NodeList:elementAt	(I)Lorg/htmlparser/Node;
    //   307: checkcast 496	org/htmlparser/tags/MetaTag
    //   310: ldc_w 498
    //   313: invokevirtual 501	org/htmlparser/tags/MetaTag:getAttribute	(Ljava/lang/String;)Ljava/lang/String;
    //   316: invokevirtual 405	java/lang/String:toLowerCase	()Ljava/lang/String;
    //   319: astore 28
    //   321: bipush 255
    //   323: aload 28
    //   325: ldc_w 503
    //   328: invokevirtual 410	java/lang/String:indexOf	(Ljava/lang/String;)I
    //   331: if_icmpne +312 -> 643
    //   334: bipush 255
    //   336: aload 28
    //   338: ldc_w 505
    //   341: invokevirtual 410	java/lang/String:indexOf	(Ljava/lang/String;)I
    //   344: if_icmpeq +46 -> 390
    //   347: goto +296 -> 643
    //   350: aload_0
    //   351: getfield 50	org/htmlparser/parserapplications/SiteCapturer:mPages	Ljava/util/ArrayList;
    //   354: invokevirtual 244	java/util/ArrayList:size	()I
    //   357: istore 30
    //   359: iload 29
    //   361: iload 30
    //   363: if_icmpge +27 -> 390
    //   366: aload_0
    //   367: getfield 50	org/htmlparser/parserapplications/SiteCapturer:mPages	Ljava/util/ArrayList;
    //   370: iload 29
    //   372: invokevirtual 289	java/util/ArrayList:remove	(I)Ljava/lang/Object;
    //   375: pop
    //   376: iinc 29 1
    //   379: goto -29 -> 350
    //   382: getstatic 464	org/htmlparser/parserapplications/SiteCapturer:class$org$htmlparser$tags$MetaTag	Ljava/lang/Class;
    //   385: astore 12
    //   387: goto -135 -> 252
    //   390: bipush 255
    //   392: aload 28
    //   394: ldc_w 503
    //   397: invokevirtual 410	java/lang/String:indexOf	(Ljava/lang/String;)I
    //   400: if_icmpne -168 -> 232
    //   403: bipush 255
    //   405: aload 28
    //   407: ldc_w 507
    //   410: invokevirtual 410	java/lang/String:indexOf	(Ljava/lang/String;)I
    //   413: if_icmpne -181 -> 232
    //   416: aload_1
    //   417: ifnull +10 -> 427
    //   420: aload 9
    //   422: aload_1
    //   423: iconst_1
    //   424: invokevirtual 511	org/htmlparser/util/NodeList:keepAllNodesThatMatch	(Lorg/htmlparser/NodeFilter;Z)V
    //   427: aload_0
    //   428: invokevirtual 306	org/htmlparser/parserapplications/SiteCapturer:getTarget	()Ljava/lang/String;
    //   431: astore 15
    //   433: aload_0
    //   434: aload_2
    //   435: ldc_w 295
    //   438: invokevirtual 299	org/htmlparser/parserapplications/SiteCapturer:makeLocalLink	(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    //   441: astore 16
    //   443: new 136	java/io/File
    //   446: dup
    //   447: aload 15
    //   449: aload 16
    //   451: invokespecial 309	java/io/File:<init>	(Ljava/lang/String;Ljava/lang/String;)V
    //   454: astore 17
    //   456: aload 17
    //   458: invokevirtual 319	java/io/File:getParentFile	()Ljava/io/File;
    //   461: astore 18
    //   463: aload 18
    //   465: invokevirtual 322	java/io/File:exists	()Z
    //   468: ifne +71 -> 539
    //   471: aload 18
    //   473: invokevirtual 325	java/io/File:mkdirs	()Z
    //   476: pop
    //   477: new 331	java/io/FileOutputStream
    //   480: dup
    //   481: aload 17
    //   483: invokespecial 332	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   486: astore 21
    //   488: new 513	java/io/PrintWriter
    //   491: dup
    //   492: aload 21
    //   494: invokespecial 516	java/io/PrintWriter:<init>	(Ljava/io/OutputStream;)V
    //   497: astore 22
    //   499: iconst_0
    //   500: istore 23
    //   502: aload 9
    //   504: invokevirtual 490	org/htmlparser/util/NodeList:size	()I
    //   507: istore 25
    //   509: iload 23
    //   511: iload 25
    //   513: if_icmpge +109 -> 622
    //   516: aload 22
    //   518: aload 9
    //   520: iload 23
    //   522: invokevirtual 494	org/htmlparser/util/NodeList:elementAt	(I)Lorg/htmlparser/Node;
    //   525: invokeinterface 521 1 0
    //   530: invokevirtual 524	java/io/PrintWriter:print	(Ljava/lang/String;)V
    //   533: iinc 23 1
    //   536: goto -34 -> 502
    //   539: aload 18
    //   541: invokevirtual 527	java/io/File:isDirectory	()Z
    //   544: ifne -67 -> 477
    //   547: new 136	java/io/File
    //   550: dup
    //   551: aload 18
    //   553: invokevirtual 319	java/io/File:getParentFile	()Ljava/io/File;
    //   556: new 138	java/lang/StringBuffer
    //   559: dup
    //   560: invokespecial 139	java/lang/StringBuffer:<init>	()V
    //   563: aload 18
    //   565: invokevirtual 530	java/io/File:getName	()Ljava/lang/String;
    //   568: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   571: ldc_w 532
    //   574: invokevirtual 145	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   577: invokevirtual 151	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   580: invokespecial 158	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   583: astore 19
    //   585: aload 19
    //   587: invokevirtual 322	java/io/File:exists	()Z
    //   590: ifne +9 -> 599
    //   593: aload 19
    //   595: invokevirtual 325	java/io/File:mkdirs	()Z
    //   598: pop
    //   599: new 136	java/io/File
    //   602: dup
    //   603: aload 19
    //   605: aload 17
    //   607: invokevirtual 530	java/io/File:getName	()Ljava/lang/String;
    //   610: invokespecial 158	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   613: astore 20
    //   615: aload 20
    //   617: astore 17
    //   619: goto -142 -> 477
    //   622: aload 22
    //   624: invokevirtual 533	java/io/PrintWriter:close	()V
    //   627: goto -395 -> 232
    //   630: astore 24
    //   632: aload 24
    //   634: invokevirtual 346	java/io/FileNotFoundException:printStackTrace	()V
    //   637: goto -405 -> 232
    //   640: aload 4
    //   642: athrow
    //   643: iload 8
    //   645: istore 29
    //   647: goto -297 -> 350
    //
    // Exception table:
    //   from	to	target	type
    //   64	108	111	org/htmlparser/util/EncodingChangeException
    //   47	64	167	ParserException
    //   64	108	167	ParserException
    //   113	164	167	ParserException
    //   233	477	167	ParserException
    //   477	533	167	ParserException
    //   539	615	167	ParserException
    //   622	627	167	ParserException
    //   632	637	167	ParserException
    //   477	533	630	java/io/FileNotFoundException
    //   622	627	630	java/io/FileNotFoundException
  }

  public void setCaptureResources(boolean paramBoolean)
  {
    this.mCaptureResources = paramBoolean;
  }

  public void setFilter(NodeFilter paramNodeFilter)
  {
    this.mFilter = paramNodeFilter;
  }

  public void setSource(String paramString)
  {
    if (paramString.endsWith("/"))
      paramString = paramString.substring(0, paramString.length() - 1);
    this.mSource = paramString;
  }

  public void setTarget(String paramString)
  {
    this.mTarget = paramString;
  }

  class LocalBaseHrefTag extends BaseHrefTag
  {
    private final SiteCapturer this$0;

    public String toHtml()
    {
      return "";
    }
  }

  class LocalImageTag extends ImageTag
  {
    private final SiteCapturer this$0;

    public void doSemanticAction()
      throws ParserException
    {
      String str = getImageURL();
      if (this.this$0.isToBeCaptured(str))
      {
        if ((!(this.this$0.mCopied.contains(str))) && (!(this.this$0.mImages.contains(str))))
          this.this$0.mImages.add(str);
        if (this.this$0.getCaptureResources())
          str = this.this$0.makeLocalLink(str, this.this$0.mParser.getLexer().getPage().getUrl());
        setImageURL(str);
      }
    }
  }

  class LocalFrameTag extends FrameTag
  {
    private final SiteCapturer this$0;

    public void doSemanticAction()
      throws ParserException
    {
      boolean bool;
      String str = getFrameLocation();
      if (this.this$0.isToBeCaptured(str))
      {
        if (!(this.this$0.mFinished.contains(str)))
          break label81;
        bool = true;
      }
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                if ((bool) || ((!(bool)) && (this.this$0.getCaptureResources())))
                  str = this.this$0.makeLocalLink(str, this.this$0.mParser.getLexer().getPage().getUrl());
                setFrameLocation(str);
                return;
                label81: if (!(this.this$0.mPages.contains(str)))
                  break;
                bool = true;
              }
              if (!(this.this$0.mCopied.contains(str)))
                break;
              bool = false;
            }
            if (!(this.this$0.mImages.contains(str)))
              break;
            bool = false;
          }
          bool = this.this$0.isHtml(str);
          if (!(bool))
            break;
          this.this$0.mPages.add(str);
        }
        this.this$0.mImages.add(str);
      }
    }
  }

  class LocalLinkTag extends LinkTag
  {
    private final SiteCapturer this$0;

    public void doSemanticAction()
      throws ParserException
    {
      boolean bool;
      String str = getLink();
      if (this.this$0.isToBeCaptured(str))
      {
        if (!(this.this$0.mFinished.contains(str)))
          break label81;
        bool = true;
      }
      while (true)
      {
        while (true)
        {
          while (true)
          {
            while (true)
            {
              while (true)
              {
                if ((bool) || ((!(bool)) && (this.this$0.getCaptureResources())))
                  str = this.this$0.makeLocalLink(str, this.this$0.mParser.getLexer().getPage().getUrl());
                setLink(str);
                return;
                label81: if (!(this.this$0.mPages.contains(str)))
                  break;
                bool = true;
              }
              if (!(this.this$0.mCopied.contains(str)))
                break;
              bool = false;
            }
            if (!(this.this$0.mImages.contains(str)))
              break;
            bool = false;
          }
          bool = this.this$0.isHtml(str);
          if (!(bool))
            break;
          this.this$0.mPages.add(str);
        }
        this.this$0.mImages.add(str);
      }
    }
  }
}